<template>
<transition name="el-fade-in-linear">
    <div class="printer" v-show="isShow">
        <div class="mainBox">
            <!-- <img class="closeBtn" @click="closeBtn" src="../assets/img/closeBtn.png" alt=""> -->
            <div class="infoBox">
                <div class="name">深空猎人一号</div>
            </div>
            <div class="codeBox">
                <div class="code">
                    <img src="../assets/img/printer.png" alt="">
                </div>
            </div>
            <div class="tips">
                <div>请不要走开，您的照片正在打印中...</div>
            </div>
        </div>
    </div>
</transition>
</template>

<script>
export default {
    props:{
        // 是否展示
        isShow:false,
    },
    watch:{
        isShow(newVal,oldVal){
            if(newVal == true){
                // 调用打印
                this.printerFun();
            }
        }
    },
    methods:{
        // 打印功能
        printerFun(){
            console.log('调用打印');
            setTimeout(() => {
                this.$emit('update:isShow',false)
                this.$emit('printEnd')
            }, 2000);
        },
    },
    mounted(){

    }
}
</script>

<style lang="less" scoped>
.printer{
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    .mainBox{
        width: 760px;
        height: 960px;
        margin: 0 auto;
        margin-top: 396px;
        background-image: url('../assets/img/propImg.png');
        background-size: 100% 960px;
        position: relative;
        padding-top: 140px;
        box-sizing: border-box;
        padding-right: 20px;
        .closeBtn{
            width: 86px;
            height: 83px;
            position: absolute;
            right: -41px;
            top: -42px;
        }
        .infoBox{
            width: 100%;
            height: auto;
            text-align: center;
            .name{
                font-size: 48px;
                color: #000000;
                font-weight: bold;
            }
        }
        .codeBox{
            width: 400px;
            height: 400px;
            background-image: url('../assets/img/Rectangle 30399.png');
            background-size: 100% 400px;
            margin: 0 auto;
            margin-top: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            .code{
                width: 340px;
                height: 340px;
                display: flex;
                align-items: center;
                justify-content: center;
                img{
                    width: 240px;
                    height: 240px;
                }
            }
        }
        .tips{
            width: 100%;
            font-size: 32px;
            color: #000000;
            text-align: center;
            margin-top: 26px;
            font-weight: bold;
        }
    }
}
</style>